package com.example.bbook.util;

import org.springframework.stereotype.Service;

import java.util.HashMap;

public class HashMapTool {
    /**
     * @param fields
     * @param type
     * @param title
     * @param showType 1111 add/delete/update/query
     * @return
     */
    public HashMap<String, Object> getFieldsMap(String fields, Object type, String title, Object showType) {
        HashMap<String, Object> resMap = new HashMap<>();
        resMap.put("title", title);
        resMap.put("dataIndex", fields);
        resMap.put("key", fields);
        resMap.put("dataType", type);
        resMap.put("showType", showType);
        return resMap;
    }

    public HashMap<String, Object> getFieldsMap(String fields, Object type, String title, Object showType, String[] showKey) {
        HashMap<String, Object> resMap = new HashMap<>();
        resMap.put("title", title);
        resMap.put("dataIndex", fields);
        resMap.put("key", fields);
        resMap.put("dataType", type);
        resMap.put("showType", showType);
        resMap.put("showKey", showKey);
        return resMap;
    }

    public HashMap<String, Object> getListKeyValue(String key, Object value, String title) {
        HashMap<String,Object> hashMap = new HashMap<>();
        hashMap.put("key", key);
        hashMap.put("value", value);
        hashMap.put("title", title);
        return hashMap;
    }
}
